<?php
namespace API\Controller;
use Think\Controller;
/**
* 登录业务
*/
class LoginController extends PublicController
{
	public function login(){
		if (IS_POST) {
			$data['pwd']   = $this -> HdEncrypt($_POST['pwd']);
			$data['utel']  = $_POST['utel'];
		}
		elseif(IS_GET){
			$data['pwd']   = $this -> HdEncrypt($_GET['pwd']);
			$data['utel']  = $_GET['utel'];
		}
		if(!empty($data['pwd'])&&!empty($data['utel'])){
              $m = M("Users");
              $result = $m -> where($data) ->find();
              if ($result) {
              	return PublicController::codedate($result['uid'],"uid");
              }else{
                 return PublicController::codedate(0,"fail");	
              }
		}else{
			return PublicController::codedate(403,"");
		}
	}
	
}